﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace Solidi
{
	public static class DependencyContainerExtensions
	{
		public static T Resolve<T>(this IDependencyContainer source)
		{
			return Resolve<T>(source, null);
		}

		public static T Resolve<T>(this IDependencyContainer source, string name)
		{
			return (T)Resolve(source, typeof(T), name);
		}

		public static object Resolve(this IDependencyContainer source, Type type)
		{
			return Resolve(source, type, null);
		}

		public static object Resolve(this IDependencyContainer source, Type type, string name)
		{
			return source.Resolve(new DependencyKey(type, name));
		}

		public static bool Release(this IDependencyContainer source, object instance)
		{
			return source.Resolver.Release(source, instance);
		}
	}
}
